package com.timber.util;

/**
 * event class to pass any class extending SLDataObject
 */

/**
 * SLDataChangeEvent class encapsulates data change events in the SL
 * data model. It contains members indicating the reason for data change,
 * reference to source, and changed object
 *
 */
public class SLDataChangeEvent extends java.util.EventObject
{

  /**	record update 	*/
  public static final int RECORD_UPDATE = 1;
  /**	record add	*/
  public static final int RECORD_ADD 	= 2;
  /**	record delete	*/
  public static final int RECORD_DELETE = 3;
  /**	data change	*/
  public static final int DATA_CHANGE 	= 4;
  /**	sys admin	*/
  public static final int SYS_ADMIN 	= 5;

  protected Object messageO;

  public int reason = 0;

    /**
     *	constractor for empty DATA_CHANGE event
     */
  public SLDataChangeEvent()
  { this( DATA_CHANGE ); }

    /**
     *	empty event
     *	@param r event reason
     */
  public SLDataChangeEvent( int r )
  {
    this( null, null, r );
  }

  /**
   *	constructor, DATA_CHANGE as reason
   *	@param source	source of event
   *	@param o	event data object
   */
  public SLDataChangeEvent( Object source, Object o )
  {
    this( source, o, DATA_CHANGE );
  }

  /**
   *	constructor
   *	@param source	source of event
   *	@param o	event data object
   *	@param r event reason
   */
  public SLDataChangeEvent( Object source, Object o, int r )
  {
    super( source );
    messageO = o;
    reason = r;
  }

  public Object getDataChangeObj() { return messageO; }

}
